
function getPic() {
	$("#yzm").css("display","block");
	var encryptmobile = $("#encryptmobile").val();
	if(encryptmobile ==""){
		layer.msg("登陆已失效，请重新登录");
		return;
	}
	$("#pic").attr('src', "/fare/getVerify?code=" + new Date().getTime()+"&encryptmobile="+encryptmobile);
}
function sendRadomNum() {
	$.post("sendRadomNum", "mobile=" + $("#desmobile").val(), function(a) {
		var b = JSON.parse(a);
		d = b.rsp_desc;
		layer.msg(d);
	})
}
function radomLogin() {
	password = $("#password").val();
	mobile = $("#desmobile").val();
	$.ajax({
		url: "radomLogin",
		async: false,
		method:"post",
		data:{
			'password': password,
			'mobile': mobile
		},
		success: function(a) {
			if (mobile == "") {
				layer.msg("登陆失败")
			} else if (a.indexOf(mobile) > -1) {
				layer.msg("登陆成功");
				long();
				getPic();
			} else {
				layer.msg("登陆失败")
			}
		}
	})
}
function long(){
	$.ajax({
		url: "getLongInviCode",
		async: false,
		success: function(a) {
			if(a!="ck已失效，请重新登录"){
				$("#encryptmobile").val(a);
			}
		}
	})
}
function ad() {
	var encryptmobile = $("#encryptmobile").val();
	if(encryptmobile ==""){
		layer.msg("登陆已失效，请重新登录");
		return;
	}
	var mobile = $("#mobile").val();
	var encryptmobile = $("#encryptmobile").val();
	var validateCode = $("#validateCode").val();
	$.post("ad", {
		'encryptmobile': encryptmobile,
		'phone': encryptmobile,
		'mobile': mobile,
		'validateCode': validateCode,
	}, function(a) {
		var data = JSON.parse(a);
		if (data.yzfail == 'FAIL') {
			layer.msg("验证码错误")
        } else if (data.yzsuccess == 'SUCCESS') {
            if (data.Rsptype == '3336' || data.Rsptype == '3337') {
                layer.msg('请输入正确的邀请码');
            } else if (data.Rsptype == '3335') {
                layer.msg('自己分享的口令不可以助力自己哦！');
            } else if (data.Rsptype == '3339' || data.Rsptype == '3340' || data.Rsptype == '3338') {
                layer.msg('您是老用户，助力失败');
            } else if (data.Rsptype == '3341') {
                layer.msg('邀请码已经超出助力限制');
            } else if (data.Rsptype == '5555') {
                layer.msg('当前参与活动用户过多，请稍后再试！');
            } else if (data.Rsptype == '7333') {
                layer.msg('邀请码已失效！');
            } else if (data.Rsptype == '7334') {
                layer.msg('本月宽带用户邀请名额已满!');
            } else if (data.Rsptype == '3333') {
                layer.msg('传入手机号为空');
            } else if (data.Rsptype == '3433') {
                layer.msg('请输入正确的邀请码');
            } else if (data.Rsptype == '3322') {
                layer.msg('很抱歉，您的账号存在异常');
            } else if (data.Rsptype == 'flow') {
                layer.msg('助力成功');
            }
	}})
}